﻿using SuperCaptcha.Mvc.Infrastructure;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace System.Web.Mvc.Html
{
    public static class CaptchaExtensions
    {
        public static IHtmlString Captcha(this HtmlHelper htmlHelper)
        {
            IHtmlString injextText = htmlHelper.TextBox("CaptchaText", null, new Dictionary<string, object>() 
            {
                {"class","form-control"}
            });
            return new Captcha(injextText);
        }

        public static IHtmlString CaptchaFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes)
        {
            IHtmlString injextText = htmlHelper.TextBoxFor(expression, htmlAttributes);
            return new Captcha(injextText);
        }
    }
}
